package com.neusoft.control;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.neusoft.bean.AdminInfoBean;
import com.neusoft.myutils.MyUtil;
import com.neusoft.service.AdminInfoService;

/**
 * 注册转发控制
 */
@WebServlet("/AddAdminInfoServlet")
public class AddAdminInfoServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
AdminInfoBean aib = MyUtil.convertRequestParameters2Bean(request, AdminInfoBean.class);
		
		
		int i = MyUtil.getInstance(AdminInfoService.class).doAddAdminInfo(aib);
		if (i>0) {
			List<AdminInfoBean> aiblst =  MyUtil.getInstance(AdminInfoService.class).getAllAdminInfo();
			request.getSession().setAttribute("aiblst", aiblst);
			request.getRequestDispatcher("addAdmin/AddSuccess.jsp").forward(request, response);
		} else {

		}
	}

}
